﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Telerik.Windows;
using Telerik.Windows.Controls;

namespace Biciq.Silverlight.UI
{
    public partial class AperturaCajaVista : UserControl
    {
        public AperturaCajaVista()
        {
            InitializeComponent();
        }
        /// <summary>
        /// This method is raised when a key is pressed in the numeric textbox, and is used for return 0 value when delete is clicked
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event Arguments</param>
        private void RadMaskedNumericInput_KeyDown(object sender, KeyEventArgs e)
        {
            RadMaskedNumericInput inputControl = sender as RadMaskedNumericInput;


            if (e.Key == Key.Delete || e.Key == Key.Back)
            {
                inputControl.Value = 0;
            }
        }

        /// <summary>
        /// This method is raised when a key is pressed in the numeric textbox, and is used for return 0 value when delete is clicked
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event Arguments</param>
        private void RadMaskedCurrencyInput_KeyDown(object sender, KeyEventArgs e)
        {
            RadMaskedCurrencyInput currencyControl = sender as RadMaskedCurrencyInput;
            if (e.Key == Key.Delete || e.Key == Key.Back)
            {
                currencyControl.Value = 0;
            }
        }

        /// <summary>
        /// This method is raised when the value of RadMaskedNumericInput was changed
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event Arguments</param>
        private void RadMaskedNumericInput_ValueChanged(object sender, RadRoutedEventArgs e)
        {
            RadMaskedNumericInput inputControl = sender as RadMaskedNumericInput;
            if (inputControl.Value == null)
            {
                inputControl.Value = 0;
            }

        }
    }
}
